<template>
  <div class="conversation-view">
    <div class="filter-container">
      <conversation-filter @search="handleSearch" />
    </div>
    
    <div class="content-container">
      <div class="list-container">
        <conversation-list
          :list="store.list"
          :loading="store.loading"
          :pagination="store.pagination"
          @row-click="handleRowClick"
          @page-change="handlePageChange"
        />
      </div>
      
      <div class="detail-container">
        <conversation-detail
          :detail="store.detail"
          :messages="store.messages"
          :loading="store.loading"
        />
      </div>
    </div>
  </div>
</template>

<script setup>
import { useConversationStore } from '@/stores/session'
import ConversationFilter from '@/components/session/SessionFilter.vue'
import ConversationList from '@/components/session/SessionList.vue'
import ConversationDetail from '@/components/session/SessionDetail.vue'

    const store = useConversationStore()
    
    // 初始化加载数据
    store.fetchList()
    
    const handleSearch = (filters) => {
      store.updateFilters(filters)
    }
    
    const handleRowClick = (row) => {
      store.fetchDetail(row.id)
    }
    
    const handlePageChange = (page) => {
      store.changePage(page)
    }

</script>

<style scoped>
.conversation-view {
  padding: 24px;
  background: linear-gradient(135deg, rgba(0, 20, 40, 0.9) 0%, rgba(0, 40, 80, 0.9) 100%);
  min-height: calc(100vh - 48px);
}

.filter-container {
  margin-bottom: 24px;
}

.content-container {
  display: flex;
  gap: 24px;
  animation: fadeIn 0.5s ease;
}

.list-container {
  width: 38%;
  min-width: 380px;
}

.detail-container {
  flex: 1;
  background: linear-gradient(135deg, rgba(0, 20, 40, 0.9) 0%, rgba(0, 40, 80, 0.9) 100%);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.2);
  border: 1px solid rgba(0, 212, 255, 0.3);
  transition: all 0.3s ease;
  overflow: hidden;
  backdrop-filter: blur(20px);
}

.detail-container:hover {
  box-shadow: 0 6px 24px rgba(0, 212, 255, 0.3);
  border-color: rgba(0, 212, 255, 0.5);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1200px) {
  .content-container {
    flex-direction: column;
  }
  
  .list-container {
    width: 100%;
    min-width: auto;
  }
}
</style>